﻿@{
    Layout = null;
}
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>帐号注册</title>
    <!-- Favicon -->
    <link rel="icon" href="/dist/media/img/favicon.png" type="image/png">
    <!-- Bundle Styles -->
    <link rel="stylesheet" href="/vendor/bundle.css">
    <!-- App styles -->
    <link rel="stylesheet" href="/dist/css/app.min.css">
</head>
<body class="form-membership">

    <div class="form-wrapper">

        <!-- logo -->
        <div class="logo">
            <svg version="1.1" xmlns="http://www.w3.org/2000/svg"
                 xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
                 width="612px" height="612px" viewBox="0 0 612 612"
                 style="enable-background:new 0 0 612 612;" xml:space="preserve">
            <g>
            <g id="_x32__26_">
            <g>
            <path d="M401.625,325.125h-191.25c-10.557,0-19.125,8.568-19.125,19.125s8.568,19.125,19.125,19.125h191.25
                    c10.557,0,19.125-8.568,19.125-19.125S412.182,325.125,401.625,325.125z M439.875,210.375h-267.75
                    c-10.557,0-19.125,8.568-19.125,19.125s8.568,19.125,19.125,19.125h267.75c10.557,0,19.125-8.568,19.125-19.125
                    S450.432,210.375,439.875,210.375z M306,0C137.012,0,0,119.875,0,267.75c0,84.514,44.848,159.751,114.75,208.826V612
                    l134.047-81.339c18.552,3.061,37.638,4.839,57.203,4.839c169.008,0,306-119.875,306-267.75C612,119.875,475.008,0,306,0z
                    M306,497.25c-22.338,0-43.911-2.601-64.643-7.019l-90.041,54.123l1.205-88.701C83.5,414.133,38.25,345.513,38.25,267.75
                    c0-126.741,119.875-229.5,267.75-229.5c147.875,0,267.75,102.759,267.75,229.5S453.875,497.25,306,497.25z" />
                    </g>
                </g>
            </g>
            <g></g>
            <g></g>
            <g></g>
            <g></g>
            <g></g>
            <g></g>
            <g></g>
            <g></g>
            <g></g>
            <g></g>
            <g></g>
            <g></g>
            <g></g>
            <g></g>
            <g></g>
        </svg>
        </div>
        <!-- ./ logo -->

        <h5>注册</h5>

        <!-- form -->

        <div class="form-group">
            <input type="text" id="account" class="form-control" placeholder="帐号" required autofocus maxlength="20" minlength="6">
        </div>

        <div class="form-group">
            <input type="password" id="password" class="form-control" placeholder="密码" required maxlength="20" minlength="6">
        </div>
        <div class="form-group">
            <input type="text" id="nicename" class="form-control" placeholder="昵称" required maxlength="10">
        </div>
        <div class="form-group">
            <input type="text" id="email" class="form-control" placeholder="邮箱">
        </div>
        <button id="bt_subit" class="btn btn-primary btn-block">注册</button>
        <span id="err" style="margin-top:20px ;display:none;color:red"></span>
        <hr>
        <a href="/Users/login" class="btn btn-outline-light btn-sm">登陆</a>

        <!-- ./ form -->

    </div>

    <!-- Bundle -->
    <script src="/js/jquery.min.js"></script>
    <script src="/vendor/bundle.js"></script>
    <script src="/vendor/feather.min.js"></script>
    <!-- App scripts -->
    <script src="/dist/js/app.min.js"></script>
    <script>
        $(document).ready(function () {

            $("#bt_subit").click(function () {

                var modle = {
                    Account: $("#account").val(),
                    NickName: $("#nicename").val(),
                    PassWord: $("#password").val(),
                    Email: $("#email").val()
                };
                $.ajax({
                    type: 'post',
                    url: '/Users/userRegister',
                    data: modle,
                    async: false,
                    dataType: 'json',
                    success: function (data) {
                        if (data.code == 200) {
                            location.href = "/Users/login";
                        } else {
                            ShowErr(data.message);
                        }

                    }
                });

            });

            function ShowErr(err) {

                $("#err").text(err);
                $("#err").show();

            }
        });
    </script>
</body>
</html>